<?php
session_start();
define("WB_biaoshi", 'tqqweibo'); //标识
include_once( 'config.php' );
include_once( 'txwboauth.php' );

$o = new WeiboOAuth(QQWB_AKEY, QQWB_SKEY, $_SESSION['keys']['oauth_token'], $_SESSION['keys']['oauth_token_secret']);
$last_key = $o->getAccessToken($_REQUEST['oauth_verifier']); //获取ACCESSTOKEN
$_SESSION['last_key'] = $last_key;
$c = new WeiboClient(QQWB_AKEY, QQWB_SKEY, $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']);
$msz = $c->getinfo('json');
if ($msz['ret'] == 0 && !empty($msz)) {
    $name = $msz['data']['name']; //微博账号，不可修改
	$nick = $msz['data']['nick']; //微博昵称，可修改
    //使用后不能在修改下面参数否则出错
	$param=array('action'=>"http://".URL."/user/register_api.php",'orther_web_id'=>$name,'orther_web_name'=>$nick,'orther_web'=>'QQ微博');
    echo form($param);
    //header("Location:$urls");
    exit;
} else {
    Header("Location:" . WB_Qqurl);
    exit;
}
?>
